package com.linked.goods.goodsbase.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.linked.goods.goodsbase.bean.dto.GoodsVersionDTO;
import com.linked.goods.goodsbase.bean.param.GoodsQueryParam;
import com.linked.goods.goodsbase.bean.view.GoodsQueryView;
import com.linked.goods.goodsbase.mapper.IGoodsQueryMapper;
import com.linked.goods.goodsbase.service.IGoodsQueryService;
import com.linked.universal.bean.goods.goods.LinkedGoods;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :dbq
 * @date : 2023/5/25 11:00
 * @description : desc
 */
@Slf4j
@Service
public class GoodsQueryServiceImpl implements IGoodsQueryService {

    private final IGoodsQueryMapper goodsQueryMapper;

    private final ObjectMapper mapper;

    public GoodsQueryServiceImpl(IGoodsQueryMapper goodsQueryMapper, ObjectMapper mapper) {
        this.goodsQueryMapper = goodsQueryMapper;
        this.mapper = mapper;
    }

    @Override
    public IPage<GoodsQueryView> queryGoodsPage(GoodsQueryParam param) throws Exception {
        return goodsQueryMapper.queryGoodsPage(param);
    }

    @Override
    public List<GoodsVersionDTO> queryGoodsVersionList(String goodsId) {
        return goodsQueryMapper.queryGoodsVersionList(goodsId);
    }

    @Override
    public LinkedGoods queryLinkedGoods(String goodVersionId) {
        return goodsQueryMapper.queryLinkedGoods(goodVersionId);
    }
}
